package com.example.demo.config;

import org.apache.tomcat.util.descriptor.LocalResolver;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


/**
 * @author yanglup
 * @create 2020-10-19 16:03
 * 完全配置MVC-使用我们自己的MVC
 */
@Configuration
public class MyMvcConfig implements WebMvcConfigurer {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/hello.html").setViewName("hello");
        registry.addViewController("/").setViewName("login");
        registry.addViewController("/login.html").setViewName("login");
        registry.addViewController("/index.html").setViewName("index");
        registry.addViewController("/Orderslist.html").setViewName("Orderslist");
        registry.addViewController("/Ordersadd.html").setViewName("Ordersadd");
        registry.addViewController("/Ordersupdate.html").setViewName("Ordersupdate");
        registry.addViewController("/Orderslistquery.html").setViewName("Orderslistquery");
        registry.addViewController("/Swiperlist.html").setViewName("Swiperlist");
        registry.addViewController("/Swiperadd.html").setViewName("Swiperadd");
        registry.addViewController("/Swiperupdate.html").setViewName("Swiperupdate");
        registry.addViewController("/Swiperlistquery.html").setViewName("Swiperlistquery");
        registry.addViewController("/WXFeedbacklist.html").setViewName("WXFeedbacklist");
        registry.addViewController("/WXFeedbackcheck.html").setViewName("WXFeedbackcheck");
        registry.addViewController("/Administratorlist.html").setViewName("Administratorlist");
        registry.addViewController("/Administratoradd.html").setViewName("Administratoradd");
        registry.addViewController("/Administratorupdate.html").setViewName("Administratorupdate");
        registry.addViewController("/Booklist.html").setViewName("Booklist");
        registry.addViewController("/Bookadd.html").setViewName("Bookadd");
        registry.addViewController("/Bookupdate.html").setViewName("Bookupdate");
        registry.addViewController("/Booklistquery.html").setViewName("Booklistquery");
        registry.addViewController("/Categoryicongonglist.html").setViewName("Categoryicongonglist");
        registry.addViewController("/Categoryicongongupdate.html").setViewName("Categoryicongongupdate");
        registry.addViewController("/Categoryicongonglistquery.html").setViewName("Categoryicongonglistquery");
        registry.addViewController("/BackUserInfolist.html").setViewName("BackUserInfolist");
        registry.addViewController("/Commentlist.html").setViewName("Commentlist");
        registry.addViewController("/Commentlistquery.html").setViewName("Commentlistquery");
        registry.addViewController("/myuploadfile.html").setViewName("myuploadfile");

    }


    //添加过滤类----暂时注释
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginHandlerInterceptor())
                .addPathPatterns("/index.html",
                        "/Orderslist.html","/Orderslist",
                        "/Ordersadd.html","/Ordersadd",
                        "/Ordersupdate.html","/Ordersupdate",
                        "/Orderslistquery.html","/Orderslistquery",
                        "/Swiperlist.html","/Swiperlist",
                        "/Swiperadd.html","/Swiperadd",
                        "/Swiperupdate.html","/Swiperupdate",
                        "/Swiperlistquery.html","/Swiperlistquery",
                        "/WXFeedbacklist.html","/wxfeedbacklist",
                        "/WXFeedbackcheck.html","/WXFeedbackcheck",
                        "/Administratorlist.html","/Administratorlist",
                        "/Administratoradd.html","/Administratoradd",
                        "/Administratorupdate.html","/Administratorupdate",
                        "/Booklist.html","/Booklist",
                        "/Bookupdate.html","/Bookupdate",
                        "/Booklistquery.html","/Booklistquery",
                        "/Bookadd.html","/Bookadd",
                        "/Categoryicongonglist.html","/Categoryicongonglist",
                        "/Categoryicongongupdate.html","/Categoryicongongupdate",
                        "/Categoryicongonglistquery.html","/Categoryicongonglistquery",
                        "/BackUserInfolist.html","/BackUserInfolist",
                        "/myuploadfile.html","/myuploadfile",
                        "/Commentlist.html","/Commentlist",
                        "/Commentlistquery.html","/Commentlistquery");
//                .excludePathPatterns("/asserts/css/*","/asserts/js/**","/asserts/img/**");
    }
}
